<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'BrandList.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link type="text/css" rel="stylesheet"
	href="/EasyBuy/statics/css/style.css" />

<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery-1.11.1.min_044d0927.js"></script>
<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery.bxslider_e88acd1b.js"></script>

<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/menu.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/lrscroll_1.js"></script>


<script type="text/javascript" src="/EasyBuy/statics/js/n_nav.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/milk_ban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/paper_ban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/baby_ban.js"></script>

</head>
<script type="text/javascript"
		src="/EasyBuy/statics/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		function hideType(){
			$(".leftNav").hide();
		}
		hideType();
		var brandId=$(".td_b").attr("title");
		$(".td_b").html("");
		$.getJSON("BrandServlet","opr=brandIdCategory&brandId="+brandId+"&level=1",callBackFL);
		function callBackFL(dataFL){
			$(".td_b").append("所有分类<br />");
			for(var j=0;j<dataFL.length;j++){
				$(".td_b").append("<a class='oneCategoryName' title='"+dataFL[j].id+"'>"+dataFL[j].name+"</a>");
			}
			$(".oneCategoryName").click(function(){
				var id=$(this).attr("title");
				$(".cate_list").html("");
				$.getJSON("ConmmodityListServlet","opr=categoryListNo&id="+id,callBack);
				function callBack(data){
					for(var i=0;i<data.length;i++){
						$(".cate_list").append("<li>"+
								"<div class='img'>"+
									"<a href='ConmmodityDetailsServlet?opr=productDetils&id="+data[i].id+"'><img src='/EasyBuy/statics/images/"+data[i].fileName+"' "+
									"width='210' height='185' />"+
									"</a>"+
								"</div>"+
								"<div class='price'>"+
									"<font>￥<span>"+data[i].price+"</span>"+
									"</font>&nbsp;"+data[i].integral+"R"+
								"</div>"+
								"<div class='name'>"+
									"<a href='#'>"+data[i].name+"</a>"+
								"</div>"+
								"<div class='carbg'>"+
									"<a class='ss' title='"+data[i].id+"'>收藏</a> <a title='"+data[i].id+"' class='j_car'>加入购物车</a>"+
								"</div>"+
							"</li>");
					}
					shouCang();
					addCar();
					$("#sheng").click(function(){
			
			
				$.getJSON("ConmmodityListServlet","opr=categorySheng&id="+id+"&level=1",callBackShengC);
			
			function callBackShengC(dataShengC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataShengC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataShengC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataShengC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataShengC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataShengC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataShengC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataShengC[i].id+"'>收藏</a> <a title='"+dataShengC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#jiang").click(function(){
			
				$.getJSON("ConmmodityListServlet","opr=categoryJiang&id="+id+"&level=1",callBackJiangC);
			
			function callBackJiangC(dataJiangC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataJiangC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataJiangC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataJiangC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataJiangC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataJiangC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataJiangC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataJiangC[i].id+"'>收藏</a> <a title='"+dataJiangC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#xiaoShang").click(function(){
			
			
				$.getJSON("ConmmodityListServlet","opr=categoryShang&id="+id+"&level=1",callBackShangC);
			
			function callBackShangC(dataShangC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataShangC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataShangC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataShangC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataShangC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataShangC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataShangC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataShangC[i].id+"'>收藏</a> <a title='"+dataShangC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#xiaoXia").click(function(){
			
			
				$.getJSON("ConmmodityListServlet","opr=categoryXia&id="+id+"&level=1",callBackXiaC);
			
			function callBackXiaC(dataXiaC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataXiaC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXiaC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXiaC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXiaC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXiaC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXiaC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXiaC[i].id+"'>收藏</a> <a title='"+dataXiaC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#xin").click(function(){
			$.getJSON("ConmmodityListServlet","opr=categoryXin&id="+id+"&level=1",callBackXinC);
			
			function callBackXinC(dataXinC){
				$(".cate_list").html("");
						for ( var i = 0; i < dataXinC.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXinC[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXinC[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXinC[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXinC[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXinC[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXinC[i].id+"'>收藏</a> <a title='"+dataXinC[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
				}
			});
		}
		
		
		//加入购物车
		addCar();
		function addCar(){
			$(".j_car").click(function(){
			var productId=$(this).attr("title");
			var userId=$(".user").attr("title");
			add();
			function add(){
				if("${applicationScope.id}" == ""){
					location.href = "/EasyBuy/pre/Login.jsp";
				}else{
					$.get("BuyCarServlet","opr=addBuyCar&uId="+userId+"&pId="+productId+"&pNum=1",function(data){
						if(data == "cg"){
							alert("添加成功");
						}else if(data=="sb"){
							alert("添加失败");
						}
					});
				}
			}
		});
		}
		
		//收藏
		shouCang();
		function shouCang(){
			$(".ss").click(function(){
			var productId=$(this).attr("title");
			var userId=$(".user").attr("title");
			$.getJSON("/EasyBuy/CollectServlet","opr=categoryShou&productId="+productId+"&userId="+userId,callBackShou);
			function callBackShou(dataShou){
				if(dataShou=="have"){
					alert("已有该收藏");
				}else if(dataShou=="success"){
					alert("收藏成功");
				}else if(dataShou=="error"){
					alert("收藏失败");
				}
			}
		});
		}
		$("#xin").click(function(){
			var brand_id=$(".td_b").attr("title");
				$.getJSON("BrandServlet","opr=brandIdListsNoXin&brand_id="+ brand_id,callBackXin);
			function callBackXin(dataXin){
				$(".cate_list").html("");
						for ( var i = 0; i < dataXin.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXin[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXin[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXin[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXin[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXin[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXin[i].id+"'>收藏</a> <a class='j_car' title='"+dataXin[i].id+"'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
			}
		});
		$("#sheng").click(function() {
				var brand_id=$(".td_b").attr("title");
				$.getJSON("BrandServlet","opr=brandIdListsNoSheng&brand_id="+ brand_id,callBackSheng);
					function callBackSheng(dataSheng) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataSheng.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataSheng[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataSheng[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataSheng[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataSheng[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataSheng[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataSheng[i].id+"'>收藏</a> <a title='"+dataSheng[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#jiang").click(function() {
				var brand_id=$(".td_b").attr("title");
				$.getJSON("BrandServlet","opr=brandIdListsNoJiang&brand_id="+ brand_id,callBackJiang);
					function callBackJiang(dataJiang) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataJiang.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataJiang[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataJiang[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataJiang[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataJiang[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataJiang[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataJiang[i].id+"'>收藏</a> <a title='"+dataJiang[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#xiaoShang").click(function() {
				var brand_id=$(".td_b").attr("title");
				$.getJSON("BrandServlet","opr=brandIdListsNoShang&brand_id="+ brand_id,callBackShang);
					function callBackShang(dataShang) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataShang.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataShang[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataShang[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataShang[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataShang[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataShang[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataShang[i].id+"'>收藏</a> <a title='"+dataShang[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$("#xiaoXia").click(function() {
				var brand_id=$(".td_b").attr("title");
				$.getJSON("BrandServlet","opr=brandIdListsNoXia&brand_id="+ brand_id,callBackXia);
					function callBackXia(dataXia) {
						$(".cate_list").html("");
						for ( var i = 0; i < dataXia.length; i++) {
							$(".cate_list").append("<li>"
								+ "<div class='img'>"
								+ "<a href='ConmmodityDetailsServlet?opr=productDetils&id="
								+ dataXia[i].id
								+ "'><img src='/EasyBuy/statics/images/"+dataXia[i].fileName+"' "+
								"width='210' height='185' />"
								+ "</a>"
								+ "</div>"
								+ "<div class='price'>"
								+ "<font>￥<span>"
								+ dataXia[i].price
								+ "</span>"
								+ "</font>&nbsp;"
								+ dataXia[i].integral
								+ "R"
								+ "</div>"
								+ "<div class='name'>"
								+ "<a href='#'>"
								+ dataXia[i].name
								+ "</a>"
								+ "</div>"
								+ "<div class='carbg'>"
								+ "<a class='ss' title='"+dataXia[i].id+"'>收藏</a> <a title='"+dataXia[i].id+"' class='j_car'>加入购物车</a>"
								+ "</div>"
								+ "</li>");
						}
						shouCang();
						addCar();
					}
			});
			$(".fl list_or>a").mouseenter(function(){
			$(this).addClass("now");
		});
	
		
	});
</script>
<body>
<c:if test="${list1==null }">
	<%
		request.getRequestDispatcher("/IndexServlet?opr=type&hre=BrandList").forward(request, response);
	 %>
</c:if>
	<!-- 头部 -->

	<%@ include file="../../common/header.jsp"%>
	<%@ include file="../../common/preHeader.jsp"%>
	<!--Begin Header Begin-->


	<!--End Menu End-->
	<div class="i_bg">
		<div class="postion">
			<span class="fl">全部 > 美妆个护 > 香水 > 香奈儿</span>
		</div>

		<div class="content mar_20">
			<!-- 引用浏览历史页面  -->
			<%@ include file="../../common/CategorySide.jsp"%>	
			<div class="l_list">
				<table border="0"
					style="width:100%; margin-bottom:30px; border:1px solid #eaeaea;"
					cellspacing="0" cellpadding="0">
					<tr valign="top">
						<td width="248"><div class="brand_img">
								<img src="/EasyBuy/statics/images/${brand_url }" width="226"
									height="108" />
							</div>
						</td>
						<td class="td_b" title="${brandId }" style="padding:15px 40px;" >所有分类<br /> 
							
							<!--<c:forEach items="${brandIdCategorys }" var="category" varStatus="index">
								<a href="#" name="${category.id }" class="now1">${category. name}(${category.categoryIdProductCount })</a>
								
							</c:forEach>-->
						</td>
					</tr>
				</table>
				<div class="list_t">
					<span class="fl list_or"> <a>默认</a> <a
						> <span class="fl">销量</span> <span class="i_up">销量从低到高显示</span>
							<span class="i_down">销量从高到低显示</span> </a> <a > <span
							class="fl">价格</span> <span class="i_up" id="sheng">价格从低到高显示</span> <span
							class="i_down" id="jiang">价格从高到低显示</span> </a> <a id="xin">新品</a> </span> <span
						class="fr">共发现${brandIdProductCount }件</span>
				</div>
				<div class="list_c">

					<ul class="cate_list">
						<c:forEach items="${brandIdProducts }" var="brandIdProduct">
							<li>
								<div class="img">
									<a href="ConmmodityDetailsServlet?opr=productDetils&id=${brandIdProduct.id }"><img src="/EasyBuy/statics/images/${brandIdProduct.fileName }"
										width="210" height="185" />
									</a>
								</div>
								<div class="price">
									<font>￥<span>${brandIdProduct.price }</span>
									</font> &nbsp; ${brandIdProduct.integral }R
								</div>
								<div class="name">
									<a href="#">${brandIdProduct.name }</a>
								</div>
								<div class="carbg">
									<a title="${brandIdProduct.id }" class="ss">收藏</a> <a class="j_car" title="${brandIdProduct.id }">加入购物车</a>
								</div>
							</li>
						</c:forEach>
					</ul>

					<div class="pages">
						<a class="p_pre">上一页</a><a class="cur">1</a><a
							class="p_pre">下一页</a>
					</div>
				</div>
			</div>
		</div>
		<!--End Footer End -->
		<!--End 猜你喜欢 End-->

		<%@ include file="../../common/footer.jsp"%>

		<!-- 脚部 -->
	</div>
</body>
</html>
